package com.chrray.position.service.web.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chrray.position.domain.FdJobCategory;
import com.chrray.position.domain.FdJobSubcategory;
import com.chrray.position.mapper.position.FdJobCategoryMapper;
import com.chrray.position.mapper.position.FdJobSubcategoryMapper;
import com.chrray.position.pojo.dto.web.FdJobCategoryExe;
import com.chrray.position.pojo.dto.web.FdJobSubcategoryExe;
import com.chrray.position.service.web.WFdJobCategoryService;
import com.chrray.position.service.web.WFdJobSubcategoryService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 意见反馈表 接口实现类
 *
 * @author wusiwee
 * @email wusiwee@163.com
 * @since 1.0.1 2024-08-07
 */
@Service
@AllArgsConstructor
public class WFdJobSubcategoryServiceImpl extends ServiceImpl<FdJobSubcategoryMapper, FdJobSubcategory> implements WFdJobSubcategoryService {


    @Override
    public IPage pageList(FdJobSubcategoryExe entity) {
        LambdaQueryWrapper<FdJobSubcategory> queryWrapper = new LambdaQueryWrapper<>();

        queryWrapper.eq(!ObjectUtils.isEmpty(entity.getName()), FdJobSubcategory::getName, entity.getName());
        queryWrapper.eq( FdJobSubcategory::getCategoryId, entity.getCategoryId());
        queryWrapper.orderByDesc(FdJobSubcategory::getCreatedTime);
        IPage page = entity.getPage();
        IPage<FdJobSubcategory> pageList = this.page(page, queryWrapper);
        return  pageList;
    }
}
